﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Revis.VClinicNet.Core.Domain;

using AutoMapper;

namespace Revis.VClinicNet.App.Internal.Dto.Mappers
{
    public class EntryDtoMapper : IDtoMapper
    {
        public static Func<Entry, string> Reason = (e) => {
            return e.Content.Reason;
        };

        public void Map()
        {
            Mapper.CreateMap<EntryContent, EntryContentDto>();
            Mapper.CreateMap<Entry, EntryDto>()
                .ForMember(e => e.Patient, mo => mo.MapFrom(e => e.RelatedTo));
            Mapper.CreateMap<Entry, EntryInfoDto>()
                .ForMember(e => e.Reason, mo => mo.MapFrom(e => Reason(e)));
        }
    }
}
